function dateFormat (str) {

    const dt = new Date(str);

    const y = dt.getFullYear();
    const m = (dt.getMonth() + 1).padZero();
    const d = dt.getDate().padZero();

    const hh = dt.getHours().padZero();
    const mm = dt.getMinutes().padZero();
    const ss = dt.getSeconds().padZero();

    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
}

Number.prototype.padZero = function () {
    return this < 10 ? '0' + this : this;
};

module.exports = {
    dateFormat,
};
